package suncertify.ui;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author jshah
 * A utility class to set the properties related to client side rmi connection properties in the "suncertify.properties" file
 */
public class ClientProperty {

    /**
     * <code>Property</code> name for Rmi url to be used by client
     */
    private static final String CLIENTRMIURL = "clientRmiUrl";
    /**
     * <code>Property</code> name for Rmi port to be used by client
     */
    private static final String CLIENTRMIPORT = "clientRmiPort";
    /**
     * <code>Property</code> name for Rmi host to be used by client
     */
    private static final String CLIENTRMIHOST = "clientRmiHost";
    /**
     * P Instance of <code>Properties</code> class to set properties for "suncertify.properties"
     */
    Properties P;

    ClientProperty(){
        try {
            P = new Properties();
            P.load(new FileInputStream("suncertify.properties"));
        } catch (IOException ex) {
            Logger.getLogger(ClientProperty.class.getName()).log(Level.SEVERE, "ERROR LOADING PROPS FILE", ex);
        }

    }
     /**
     * set the value for <code>ClientProperty.CLIENTRMIHOST</code>
     * @param propValue the value of the property to be set
     */
    public void setServerRmiHostProp(String propValue){
        P.setProperty(ClientProperty.CLIENTRMIHOST, propValue);
    }
    /**
     * set the value for <code>ClientProperty.CLIENTRMIURL</code>
     * @param propValue the value of the property to be set
     */
    public void setServerRmiUrlProp(String propValue){
        P.setProperty(ClientProperty.CLIENTRMIURL, propValue);
    }
    /**
     * set the value for <code>ClientProperty.CLIENTRMIPORT</code>
     * @param propValue the value of the property to be set
     */
    public void setSeverRmiPortProp(String propValue){
        P.setProperty(ClientProperty.CLIENTRMIPORT, propValue);
    }

}
